import request from '/@/utils/request';

export function roleApi() {
	return {
		createRole: (data: object) => {
			return request({
				url: '/sys/role/create',
				method: 'POST',
				data,
			});
		},
		updateRole: (data: object) => {
			return request({
				url: '/sys/role/update',
				method: 'PUT',
				data,
			});
		},
		deleteRole: (id: any) => {
			return request({
				url: `sys/role/delete/${id}`,
				method: 'DELETE',
			});
		},
		batchDeleteRole: (data: object) => {
			return request({
				url: '/sys/role/batchdelete',
				method: 'POST',
				data,
			});
		},
		viewRole: (id: any) => {
			return request({
				url: `sys/role/view/${id}`,
				method: 'GET',
			});
		},
		searchRole: (data: object) => {
			return request({
				url: 'sys/role/search',
				method: 'POST',
				data,
			});
		},

		btnIds: (roleId: any) => {
			return request({
				url: `sys/role/btns/${roleId}`,
				method: 'GET',
			});
		},
		permissionIds: (roleId: any) => {
			return request({
				url: `sys/role/permissions/${roleId}`,
				method: 'GET',
			});
		},

		menuIds: (roleId: any) => {
			return request({
				url: `sys/role/menus/${roleId}`,
				method: 'GET',
			});
		},
		createRoltAndBtnIds: (data: object) => {
			return request({
				url: `sys/role/createbtnids`,
				method: 'POST',
				data,
			});
		},
		createRoleAndPermissionIds: (data: object) => {
			return request({
				url: `sys/role/createpermissionids`,
				method: 'POST',
				data,
			});
		},
		createRoleAndMenuIds: (data: object) => {
			return request({
				url: `sys/role/createmenudis`,
				method: 'POST',
				data,
			});
		},
		allRoles: () => {
			return request({
				url: `sys/role/all`,
				method: 'GET',
			});
		},
	};
}
